<template>
  <div class="docker">
    <div
      class="docker__item"
      v-for="(item, index) in dockerList"
      :class="{ docker__item: true, 'docker__item--active': index === currentIndex }"
      :key="item.icon"
    >
      <router-link :to="item.to">
        <div class="iconfont" v-html="item.icon"></div>
        <div class="docker__title">{{ item.text }}</div>
      </router-link>
    </div>
  </div>
</template>

<script>
export default {
  name: "Docker",
  props: ['currentIndex'],
  setup() {
    const dockerList = [
      {
        id: 0,
        icon: "&#xe8a0;",
        text: "首页",
        to: { name: 'Home' }
      },
      {
        id: 1,
        icon: "&#xe760;",
        text: "购物车",
        to: { name: 'CartList' }
      },
      {
        id: 2,
        icon: "&#xe8a9;",
        text: "订单",
        to: { name: 'OrderList' }
      },
      {
        id: 3,
        icon: "&#xe903;",
        text: "我的",
        to: { name: 'Home' }
      },
    ];
    return { dockerList };
  },
};
</script>

<style lang="scss" scoped>
@import "../style/viriables.scss";
.docker {
  display: flex;
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 0.49rem;
  padding: 0 0.18rem;
  box-sizing: border-box;
  background-color: #fff;
  border-top: 0.01rem solid $content-gbcolor;
  z-index: 999;
  &__item {
    flex: 1;
    text-align: center;
    a {
      color: $content-fontcolor;
    }
    .iconfont {
      margin: 0.07rem 0 0.02rem;
      font-size: 0.18rem;
    }
    &--active {
      a {
      color: #1fa4fc;
    }
    }
  }
  &__title {
    font-size: 0.2rem;
    // 缩放比例
    transform: scale(0.5, 0.5);
    // 以中心点缩放
    transform-origin: center top;
  }
}
</style>
